/**
 * UIObject.as
 * Andy Jiang   
 * Fusion Digital Shanghai Co,Ltd. All Rights Reserved.
 * version 0.1
 * 
 */ 

package jiezi.log
{
	import flash.text.TextField
	import flash.display.DisplayObjectContainer
	import flash.display.Sprite
	import flash.display.Shape
	import jiezi.ui.*

	public class Logger
	{
		private static var mInstance:Logger;
		private var mRoot:Frame
		private var mLogWindow:ScrollingMessageFrame

		public static function getSingleton():Logger 
		{
			if( mInstance == null )
			{
				mInstance = new Logger();
			}
			return mInstance;
		}

		public function Logger()
		{
		}

		public function initialize(root:Frame):void
		{
			mRoot = root
			mRoot.setBackdrop("imgs/cangqiong_bg_1.png");
			
			mLogWindow = UIManager.getSingleton().createFrame("ScrollingMessageFrame", "logmsg", mRoot)
			mLogWindow.setPoint(Region.TOPLEFT, Region.TOPLEFT, 4, 4)
			mLogWindow.setPoint(Region.BOTTOMRIGHT, Region.BOTTOMRIGHT, -4, -4)
		}

		public function log(msg:Object, level:uint=0):void
		{
			mLogWindow.addMessage(String(msg));
			mLogWindow.ScrollToBottom()
		}

		private function onResize():void
		{
	
		}
  }
}


